home *** CD-ROM | disk | FTP | other *** search
- // sstream standard header
- #ifndef _SSTREAM_
- #define _SSTREAM_
- #include <string>
- #include <strstream>
-
- #if __MWERKS__
- #pragma options align=mac68k
-
- #if __CFM68K__ && __USING_IMPORTED_ANSI__
- #pragma import on
- #endif
- #endif
-
- // class stringbuf
- class stringbuf : public strstreambuf {
- public:
- stringbuf(ios::openmode _W = ios::in | ios::out)
- : strstreambuf(0, 0, 0, _Mode(_W)) {}
- stringbuf(const string& _S,
- ios::openmode _W = ios::in | ios::out)
- : strstreambuf((char *)_S.c_str(), _S.length(), 0,
- _Mode(_W)) {}
- virtual ~stringbuf();
- string str() const;
- void str(const string& _S);
- protected:
- _Strstate _Mode(ios::openmode);
- };
- // class istrstream
- class istringstream : public istream {
- public:
- istringstream(openmode _W = in)
- : ios(&_Sb), istream(&_Sb), _Sb(_W) {}
- istringstream(const string& _S, openmode _W = in)
- : ios(&_Sb), istream(&_Sb), _Sb(_S, _W) {}
- virtual ~istringstream();
- stringbuf *rdbuf() const
- {return ((stringbuf *)&_Sb); }
- string str() const
- {return (_Sb.str()); }
- void str(const string& _S)
- {_Sb.str(_S); }
- private:
- stringbuf _Sb;
- };
- // class ostrstream
- class ostringstream : public ostream {
- public:
- ostringstream(openmode _W = out)
- : ios(&_Sb), ostream(&_Sb), _Sb(_W) {}
- ostringstream(const string& _S, openmode _W = out)
- : ios(&_Sb), ostream(&_Sb), _Sb(_S, _W) {}
- virtual ~ostringstream();
- stringbuf *rdbuf() const
- {return ((stringbuf *)&_Sb); }
- string str() const
- {return (_Sb.str()); }
- void str(const string& _S)
- {_Sb.str(_S); }
- private:
- stringbuf _Sb;
- };
-
- #if __MWERKS__
- #if __CFM68K__ && __USING_IMPORTED_ANSI__
- #pragma import reset
- #endif
-
- #pragma options align=reset
- #endif
-
- #endif
-
- /*
- * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
- * Consult your license regarding permissions and restrictions.
- */
-
- /* Change log:
- *94June04 PlumHall baseline
- *94Oct07 Inserted MW changes.
- */
-